/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

package Logger;

import java.util.logging.Level;
import java.io.IOException;
import java.util.logging.FileHandler;
import java.util.logging.Logger;
import java.util.logging.SimpleFormatter;
/**
 *
 * @author Inbal
 */
public class ClientLogger {


	static Logger logger = null;

	private ClientLogger(){

	}

	static public void write(Level level, String msg)
	{
		if(logger == null){
			logger = Logger.getLogger("MyLog");
			FileHandler fh;

			try {

				// This block configure the logger with handler and formatter
				fh = new FileHandler("ClientLog.log", true);
				logger.addHandler(fh);
				logger.setLevel(Level.ALL);
				SimpleFormatter formatter = new SimpleFormatter();
				fh.setFormatter(formatter);



			} catch (SecurityException e) {
				e.printStackTrace();
			} catch (IOException e) {
				e.printStackTrace();
			}
		}
		logger.log(level,msg);

		//		logger.log(Level.INFO,"fuck you!");
	}

	static public void setLevel(Level level)
	{
		logger.setLevel(level);
	}

}

    